package linkedlist.test876;

import listbyorder.utils.ListNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/15 12:43
 */
public class Solution1 {

    public ListNode middleNode(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode s = head, f = head.next;
        while (f.next != null && f.next.next != null) {
            s = s.next;
            f = f.next.next;
        }
        return s.next;
    }
}
